package com.lixw.springai.service;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @ClassName: WeatherService
 * @Description:
 * @Author: xuweiLi
 * @Create: 2025/8/26 19:02
 **/
@Service
public class WeatherService {
    @Tool(description = "根据城市名称获取天气预报")
    public String getWeatherByCity(@ToolParam(description = "城市名称") String city) {
        Map<String, String> map = Map.of(
                "北京", "1111降雨频繁，其中今天和后天雨势较强O(∩_∩)O，zz昌平yy部分地区有暴雨并伴强对流天气，带伞",
                "上海", "22222多云,15℃~27℃,南风3级，zzyy当前温度27℃。",
                "深圳", "333333多云40天，阴16天，雨30天，zzyy晴3天",
                "涿鹿县", "444444多云,19℃~23℃,、东风6级，zzyy当前温度23℃。"
                );
        return map.getOrDefault(city, "抱歉：未查询到对应城市！");
    }

    @Tool(description = "获取当前时间")
    public LocalDateTime currentDateTime() {
        return LocalDateTime.now();
    }

}